package com.google.code.stalkernet.server;

import java.net.SocketAddress;

import com.google.code.stalkernet.server.event.ServerListener;

/**
 * Stalker.Net server that accepts incoming connections.
 *
 * @author Mikhail Vladimirov
 */
public interface Server
{
    /**
     * Add listener to be notified about server-related events.
     *
     * @param serverListener listener to be added
     */
    public void addServerListener (ServerListener serverListener);

    /**
     * Remove listener notified about server-related events.
     *
     * @param serverListener listener to be removed
     */
    public void removeServerListener (ServerListener serverListener);

    /**
     * Add socket address to accept incoming connections at.
     *
     * @param socketAddress socket address to be added
     */
    public void addSocketAddress (SocketAddress socketAddress);

    /**
     * Remove socket address.
     *
     * @param socketAddress socket address to be removed
     */
    public void removeSocketAddress (SocketAddress socketAddress);

    /**
     * Get all socket addresses the server accepts connections at.
     *
     * @return an array of {@link SocketAddress} objects
     */
    public SocketAddress [] getAllSocketAddresses ();
}
